<script>
  import TencentCloudChat from '@tencentcloud/chat'
  import { getCache } from './util/util';
  export default {
    onLaunch: function() {
      console.log('*********************', TencentCloudChat.EVENT.SDK_NOT_READY)
      let userInfo = getCache('userInfo') || {}
      let onSdkNotReady = () => {
        if (!userInfo.nickname) return
        uni.$chat.login({
            userID: userInfo.id.toString(),
            userSig: userInfo.userSig
          })
          .then(res => {
            console.log(res, '123123132')
          }).catch(err => {
            console.log(err, '321321321')
          })
      };
      uni.$chat.on(TencentCloudChat.EVENT.SDK_NOT_READY, onSdkNotReady())


    },
    onShow: function() {
      console.log('App Show')
    },
    onHide: function() {
      console.log('App Hide')
    }
  }
</script>

<style lang="scss">
  /* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
  @import "uview-plus/index.scss";

  page {
    background: #f7f6fa;
  }

  view,
  text,
  scroll-view {
    box-sizing: border-box;
  }

  .u-text-left {
    text-align: left;
  }

  .u-text-center {
    text-align: center;
  }

  .u-text-right {
    text-align: right;
  }

  .u-flex-1 {
    flex: 1;
  }

  .share-btn {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    line-height: normal;
  }

  .share-btn::after {
    border: 0;
  }
</style>